package cn.wenhe9.yygh.sms.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author DuJinliang
 * 2022/4/5
 */
@Component
public class ConstantPropertiesUtils implements InitializingBean {

    @Value("${sms.apiUrl}")
    private String apiUrl;

    @Value("${sms.appId}")
    private String appId;

    @Value("${sms.appSecret}")
    private String appSecret;

    @Value("${sms.templateId}")
    private String templateId;

    @Value("${sms.timeout}")
    private long timeout;

    public static String API_URL;

    public static String APP_ID;

    public static String APP_SECRET;

    public static String TEMPLATE_ID;

    public static long TIMEOUT;

    @Override
    public void afterPropertiesSet() throws Exception {
        API_URL = apiUrl;
        APP_ID = appId;
        APP_SECRET = appSecret;
        TEMPLATE_ID = templateId;
        TIMEOUT = timeout;
    }
}
